package vn.igolf.distance;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Point;

import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JLayeredPane;
import javax.swing.JPanel;


public class HolePlayPanel extends JPanel  {
	
	private JLayeredPane layeredPane;
	private JLabel textLabel;
	
    public HolePlayPanel()    {
        setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));

        //Create and set up the layered pane.
        layeredPane = new JLayeredPane();
        layeredPane.setSize(new Dimension(1013, 636));
               
        textLabel = createColoredLabel("Minh Dinh", Color.WHITE, new Point(20,636));
        HolePlayComponent holePlayComponent = new HolePlayComponent(textLabel);
        
        layeredPane.add(holePlayComponent.mapLabel, new Integer(1), 0);
        layeredPane.add(holePlayComponent.mark1, new Integer(3), 0);
        layeredPane.add(holePlayComponent.mark2, new Integer(4), 0);
        layeredPane.add(textLabel,new Integer(2), 0);
        
        add(layeredPane);
        setSize(layeredPane.getSize());
    }

    //Create and set up a colored label.
    private JLabel createColoredLabel(String text,
                                      Color color,
                                      Point origin) {
        JLabel label = new JLabel(text);
        label.setVerticalAlignment(JLabel.TOP);
        label.setHorizontalAlignment(JLabel.CENTER);
        label.setOpaque(true);
        label.setBackground(color);
        label.setForeground(Color.black);
        label.setBorder(BorderFactory.createLineBorder(Color.black));
        label.setBounds(origin.x, origin.y, 140, 30);
        return label;
    }
}